package leetcode;

public class twenty {
    public static int mySqrt(int x) {
        for(int i=0;i<2*31;i++){
            if(x==i*i||x>i*i&&x<(i+1)*(i+1)){
                return i;
            }
        }
        return -1;

    }

    public static void main(String[] args) {
        int i = mySqrt(4);
        System.out.println(i);

    }
}
